package com.supply.controller;

import com.supply.pojo.ResultBean;
import com.supply.req.LeaveBillGroup;
import com.supply.req.OutBoundBillGroup;
import com.supply.service.LeaveProcessService;
import com.supply.service.OutBoundProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/outBoundProcess")
public class OutBoundProcessController {
    @Autowired
    private OutBoundProcessService outBoundProcessService;

    @PostMapping("/startOutBound")
    public ResultBean startOutBound(@RequestBody OutBoundBillGroup outBoundBillGroup){
        System.out.println("出库信息：" + outBoundBillGroup);
        outBoundBillGroup.setCreateTime(new Date());
        int rs = outBoundProcessService.startOutBound(outBoundBillGroup);
        return rs >= 1 ? ResultBean.success() : ResultBean.error("服务器异常");
    }

}
